package com.sdry.service.impl.cb;

import com.sdry.mapper.cb.OtherCostMapper;
import com.sdry.model.cb.OtherCostEntity;
import com.sdry.service.cb.OtherCostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OtherCostServiceImpl implements OtherCostService {

    @Autowired
    private OtherCostMapper otherCostMapper;

    @Override
    public List<OtherCostEntity> getList(String date, Long stockId) {
        return otherCostMapper.getList(date,stockId);
    }

    @Override
    public Integer add(OtherCostEntity otherCostEntity) {
        otherCostEntity.setMonery(otherCostEntity.getParameter());
        //otherCostEntity.setCreateDate(new Date());
        return otherCostMapper.insertDynamic(otherCostEntity);
    }

    @Override
    public Integer delete(String[] idArr) {
        Integer affectRow = 0;
        for (int i = 0; i < idArr.length; i++) {
            affectRow = otherCostMapper.delete(Long.parseLong(idArr[i]));
        }
        return affectRow;
    }
}
